import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
import { PersonalChannelService } from './personal-channel.service';
import { CreatePersonalChannelDto } from './dto/create-personal-channel.dto';
import { UpdatePersonalChannelDto } from './dto/update-personal-channel.dto';
import { ApiTags } from '@nestjs/swagger/dist/decorators';

@ApiTags('个人车源')
@Controller('personalchannel')
export class PersonalChannelController {
  constructor(private readonly personalChannelService: PersonalChannelService) {}

  @Post()
  async create(@Body() createPersonalChannelDto: CreatePersonalChannelDto) {
    return await this.personalChannelService.create(createPersonalChannelDto);
  }

  @Get()
  async findAll() {
    return await this.personalChannelService.findAll();
  }

  @Get('page')
  async findPage(@Query() query: any) {
    return await this.personalChannelService.findPage(query)
  }

  @Get(':id')
  async findOne(@Param('id') id: string) {
    return await this.personalChannelService.findOne(id);
  }

  @Patch(':id')
  async update(@Param('id') id: string, @Body() updatePersonalChannelDto: UpdatePersonalChannelDto) {
    return await this.personalChannelService.update(id, updatePersonalChannelDto);
  }

  @Delete(':id')
  async remove(@Param('id') id: string) {
    return await this.personalChannelService.remove(id);
  }

  @Post('delMany')
  manyRemove(@Body() body: string[]) {
    return this.personalChannelService.manyRemove(body)
  }
}
